﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using SharedGenomics.Core;
using SharedGenomics.Workbench.PresentationModel;
using SharedGenomics.Workbench.Views;

namespace SharedGenomics.Workbench.Presenters
{
    public class CategoryFilterPresenterFactory
    {
        public CategoryFilterPresenterFactory(CategoryFilterViewFactory filterViewFactory, CategoryValueViewFactory valueViewFactory)
        {
            this.FilterViewFactory = filterViewFactory;
            this.ValueViewFactory = valueViewFactory;
        }

        public virtual CategoryFilterPresenter CreateNew(IEnumerable<ValueDisplayItem<string>> categories, Func<string, IEnumerable<ValueDisplayItem<string>>> categoryValuesFunc)
        {
            categoryValuesFunc.ThrowIfNull("categoryValuesFunc");

            ICategoryFilterView filterView = this.FilterViewFactory.CreateNew();
            return new CategoryFilterPresenter(filterView, this.ValueViewFactory, categories, categoryValuesFunc);
        }

        private CategoryFilterViewFactory FilterViewFactory { get; set; }
        private CategoryValueViewFactory ValueViewFactory { get; set; }
    }
}
